﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace FinalProject.UI
{
    /// <summary>
    /// Interaction logic for AddingNewForm.xaml
    /// </summary>
    public partial class AddingNewForm : Window
    {
        public SelectionTypeClass SelectedObjectType { get; set; }

        public AddingNewForm()
        {
            this.InitializeComponent();
            this.InitializeEvents();
            // Insert code required on object creation below this point.
        }

        private void InitializeEvents()
        {
            this.btnCustomer.Click += new RoutedEventHandler(bntCustomer_Click);
            this.btnOrder.Click += btnOrder_Click;
            this.btnDelivery.Click += btnDelivery_Click;
            this.btnInvoice.Click += btnInvoice_Click;
            this.btnVoucher.Click += btnVoucher_Click;
        }

        private void btnVoucher_Click(object sender, RoutedEventArgs e)
        {
            this.SelectedObjectType = new SelectionTypeClass()
            {
                SelectedType = SelectionTypeClass.AddingType.VoucherNote,
                TabHeader = "Voucher Management",
                Key = "TabVoucher"
            };
            this.Close();
        }

        private void btnInvoice_Click(object sender, RoutedEventArgs e)
        {
            this.SelectedObjectType = new SelectionTypeClass()
            {
                SelectedType = SelectionTypeClass.AddingType.InvoiceDocument,
                TabHeader = "Invoice Management",
                Key = "TabInvoice"
            };
            this.Close();
        }

        private void btnDelivery_Click(object sender, RoutedEventArgs e)
        {
            this.SelectedObjectType = new SelectionTypeClass()
            {
                SelectedType = SelectionTypeClass.AddingType.DeliveryDocument,
                TabHeader = "Delivery Management",
                Key = "TabDelivery"
            };
            this.Close();
        }

        private void btnOrder_Click(object sender, RoutedEventArgs e)
        {
            this.SelectedObjectType = new SelectionTypeClass()
            {
                SelectedType = SelectionTypeClass.AddingType.OrderDocument,
                TabHeader = "Order Management",
                Key = "TabOrder"
            };
            this.Close();
        }

        private void bntCustomer_Click(object sender, RoutedEventArgs e)
        {
            this.SelectedObjectType = new SelectionTypeClass()
            {
                SelectedType = SelectionTypeClass.AddingType.Customer,
                TabHeader = "Customer",
                Key = "TabCustomer"
            };

            this.Close();
        }
    }

    public class SelectionTypeClass
    {
        public enum AddingType { Customer, OrderDocument, DeliveryDocument, InvoiceDocument, VoucherNote };

        public AddingType SelectedType { get; set; }

        public string TabHeader { get; set; }

        public string Key { get; set; }
    }
}